package com.zty.concurrency.example.atomic;

import com.zty.concurrency.annoations.NotThreadSafe;
import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.atomic.LongAdder;

@NotThreadSafe
@Slf4j
public class AtomicExample4 {
    public  static AtomicReference<Integer> reference= new AtomicReference<>(0);

    public static  void  main(String[] args){
        reference.compareAndSet(0,2);
        reference.compareAndSet(0,1);
        reference.compareAndSet(1,2);
        reference.compareAndSet(1,3);
        reference.compareAndSet(2,5);
        log.info("reference {}"+reference.get());





    }

}
